package com.mininglamp.utils;

import java.util.List;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;

/**
 * @author zr
 */
public class Pager {

	@Min(1)
	@Max(1000)
	private int pageSize;

	@Min(1)
	private int pageNum;

	private String orderBy;

	private String sort;

	private long totalNum;

	private List<?> datas;

	public int getPageSize() {
		return pageSize;
	}

	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}

	public int getPageNum() {
		return pageNum;
	}

	public void setPageNum(int pageNum) {
		this.pageNum = pageNum;
	}

	public String getOrderBy() {
		return orderBy;
	}

	public void setOrderBy(String orderBy) {
		this.orderBy = orderBy;
	}

	public String getSort() {
		return sort;
	}

	public void setSort(String sort) {
		this.sort = sort;
	}

	public long getTotalNum() {
		return totalNum;
	}

	public void setTotalNum(long totalNum) {
		this.totalNum = totalNum;
	}

	public List<?> getDatas() {
		return datas;
	}

	public void setDatas(List<?> datas) {
		this.datas = datas;
	}

	/**
	 * get the first result number in current page.
	 * 
	 * @return
	 */
	public int getFirstNum() {
		return this.pageSize * (pageNum - 1);
	}

}
